<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import { debounce } from '@/utils/index'
export default {
  name: 'App',
  mounted() {
    if (this._isMobile()) {
      // alert('请前往电脑端登录！')
      this.$router.replace('/to-pc')
    }
    // 解决界面报错 ResizeObserver 问题
    const _ResizeObserver = window.ResizeObserver
    window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
      constructor(callback) {
        callback = debounce(callback, 16)
        super(callback)
      }
    }
  },
  methods: {
    _isMobile() {
      const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
      return flag
    }
  }
}
</script>
<style lang="scss">
input[aria-hidden=true] {
  display: none !important;
}
</style>
